package com.base.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * <p>配置文件根据类</p>
 * @author Jason
 */
public class PropertiesUtil {
	private Properties p = new Properties();
	public PropertiesUtil(String filePath) {
		if(!StringUtil.isNotEmpty(filePath))
			filePath = "jdbc.properties";
		InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(filePath); 
		try {
			p.load(inputStream);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * 获取配置文件属性值
	 * @param key
	 * @return
	 */
	public String getProperty(String key) {
		return p.getProperty(key);
	}
}
